<%--
    Document   : home
    Created on : Oct 23, 2011, 5:06:42 PM
    Author     : Group 106
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" errorPage="error.jsp"%>
<%@page import="java.util.ArrayList" %>
<%@page import="com.aptech.model.RealEstateType" %>
<%@page import="com.aptech.model.User" %>
<%@page import="com.aptech.DAO.realEstateTypeDAO" %>
<%@page import="com.aptech.DAO.userDAO" %>

<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <link rel="stylesheet" href="CSS/css.css" />
        <!--<link rel="stylesheet" href="CSS/css_header.css" />
        <link rel="stylesheet" href="CSS/css_footer.css" /> -->
        <link rel="stylesheet" href="CSS/gallery_style.css"/>
        <link rel="stylesheet" href="CSS/msh_style.css"/>
        <link rel="stylesheet" href="CSS/mn_left.css" />
        <link rel="stylesheet" href="CSS/mn_search.css" />
        <link rel="stylesheet" href="CSS/css_houseInfo.css" />
        
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <%
                User objUser = null;
                String userID = "";
                ArrayList<RealEstateType> listRealStateType ;
                if (request.getSession().getAttribute("user") != null) {
                    realEstateTypeDAO objRealEstateTypeDAO = new realEstateTypeDAO();
                    objUser = (User) request.getSession().getAttribute("user");
                    userID = objUser.getUserID() + "";
                    listRealStateType = new ArrayList<RealEstateType>();
                    listRealStateType = objRealEstateTypeDAO.getAllRealEstateType();

    %>
    <body>

        <div id="wrap">
            <%@include file="header.jsp" %>
            
            <div class="clear"></div><!--End .clear-->
            <div id="main">
                <div id="left_sidebar">
                    <%@include file="leftSidebar.jsp" %>
                </div><!--End #left_sidebar-->
                <div id="content">
                    <%
                    userDAO objUserDAO = new userDAO();
                        int userID1 = Integer.parseInt(userID);
                        int totalMoney = objUserDAO.getUserMoney(userID1);
                        if(totalMoney!=0 && totalMoney > 15){
                    %>
                    <table width="100%" border="0" align="center" height="200px">
                <tr>
                  <td align="center" width="333">
				  <a href="postSale.jsp?realEstateStyleID=1"><input type="button" name="btnSale" value="Sale" /></a>
				  </td>
                  <td align="center" width="333">
				  <a href="postRental.jsp?realEstateStyleID=2"><input type="button" name="btnRental" value="Rental" /></a></td>
                  <td align="center" width="334">
  				  <a href="postHotel.jsp?realEstateStyleID=3"><input type="button" name="btnPaying" value="Paying" /></a>
				  </td>
                </tr>
              </table>
                    <%
                        } else{
                        %>
                    <table width="100%" border="0" align="center" height="200px">
                <tr>
                  <td align="center">
                      Tai khoan cua ban khong du tien de dang tin!<a href="payingCash.jsp"> Click here </a>de lap the hoac <a href="home.jsp"> click here </a>de quay lai trang chu
                  </td>
                </tr>
              </table>
                        <% }
                    %>
                </div><!--End #content-->
            </div><!--End #main-->
            <div class="clear"></div><!--End .clear-->
            <div id="footer">Copyright © APTECH.</div><!--End #footer-->
            <div class="clear"></div><!--End .clear-->
        </div><!--End #wrap-->
        <div class="clear"></div><!--End .clear-->
    </body>
    <%
                } else {
                    response.sendRedirect("login.jsp");
                }
    %>
</html>